<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>音频审核</title>
    <#include  "./common/head.html" />
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row row-lg">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <form class="form-horizontal m-t" id="commentForm">
                        <div class="row">
                            <label class="col-sm-1 control-label left2">发送人：</label>
                            <div class="col-sm-2 left2">
                                <input id="sender" name="sender" placeholder="发送人" type="text" class="form-control" >
                            </div>

                             <label class="col-sm-1 control-label left2">发送内容：</label>
                            <div class="col-sm-2 left2">
                                <input id="censorContent" name="censorContent" placeholder="发送内容"  type="text" class="form-control" >
                            </div>
                            <label class="col-sm-1 control-label left2">发送日期：</label>
                            <div class="col-sm-2 left2">
                                <input placeholder="开始日期" value="" 　name="sendStartTime" class="form-control layer-date laydate-icon" id="start">
                            </div>

                            <div class="col-sm-2 left2">
                                <input placeholder="结束日期" value="" 　name="sendEndTime" class="form-control layer-date laydate-icon" id="end">
                            </div>
                            <div class="col-sm-1 left2">
                                <button class="btn btn-primary"  type="button" onclick="CommonUtils.query();"><i class="fa fa-search"></i>&nbsp;点击查询</button>
                            </div>
                            <!--<div class="weixinAudio">
                                <audio src="http://music.baidu.com/cms/app/muplayer/test_mp3/1.mp3" id="media" width="1" height="1" preload="load" type="audio/mp3"></audio>
                                <span id="audio_area" class="db audio_area">
	                        <span class="audio_wrp db">
	                        <span class="audio_play_area">
		                    <i class="icon_audio_default"></i>
                                <i class="icon_audio_playing"></i>
	                        </span>
	                        </span>
	                        </span>
                            </div>-->
                        </div>
                    </form>
                    <div class="hr-line-dashed"></div>
                    <div class="row">
                        <div class="btn-group col-sm-3">
                            <button class="status btn btn-primary " type="button" value="" >全部</button>
                            <button class="status btn " type="button" value="1">未人工审核</button>
                            <button class="status btn " type="button" value="2">已人工审核</button>
                        </div>
                        <div class="btn-group col-sm-3">
                            <button class="level btn btn-primary btn-rounded " type="button" value="" >全部等级</button>
                            <button class="level btn btn-rounded" type="button" value="1">1级</button>
                            <button class="level btn btn-rounded" type="button" value="2">2级</button>
                            <button class="level btn btn-rounded" type="button" value="3">3级</button>
                            <button class="level btn btn-rounded" type="button" value="4">4级</button>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- Panel Other -->
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row row-lg">
                <div class="col-sm-12">
                    <div class="example-wrap">
                        <div class="example">
                            <table id="listTable" class="table table-bordered" data-click-to-select="true"
                                   data-toggle="table"
                                   data-side-pagination="server"
                                   data-pagination="true"
                                   data-page-list="[10,20,50]"
                                   data-pagination="true"
                                   data-page-size="10"
                                   data-pagination-first-text="首页"
                                   data-pagination-pre-text="上一页"
                                   data-pagination-next-text="下一页"
                                   data-pagination-last-text="末页"
                                   data-content-type="application/x-www-form-urlencoded"
                                   data-query-params="demo.param"
                                   data-method="post"
                                   data-height="400"
                                   data-single-select="false"
                                   data-url="/censor/getAllCensorContent">

                                <thead>
                                <tr>
                                    <th data-field="666" data-width="5%" data-align="center" data-checkbox="true" data-formatter="stateFormatter" >全选 </th>
                                    <th data-field="id" data-width="5%" data-align="center">id </th>
                                    <th data-field="censorLevel" data-width="5%" data-align="center" data-formatter="levelFormatter">审核等级</th>
                                    <th data-field="censorContent" data-width="15%" data-align="center" class="colStyle">语音内容</th>
                                    <th data-field="contentUrl" data-width="15%" data-align="center" data-formatter="audioFormatter">源语音</th>
                                    <th data-field="sender" data-width="10%" data-align="center" >发送人</th>
                                    <th data-field="senderPhoneEcrypted" data-width="15%" data-align="center" >电话</th>
                                    <th data-field="sendTime" data-width="15%" data-align="center" data-formatter="CommonUtils.formateDateTime">发送时间</th>
                                    <th data-field="userTel" data-width="15%" data-align="center"  data-formatter="actionFormatter">审核操作</th>
                                </tr>
                                </thead>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="row">

        <div class="col-sm-2 left2">
            <label class=" control-label ">审核：</label>
            <button class="btn btn-primary"  id ="checkAll" type="button">全选</button>
        </div>

        <div class="col-sm-9 left2">
            <div class="">
                <button class="patch btn btn-primary " type="button" value="-1" >保持现有等级</button>
                <button class="patch btn " type="button" value="1">1级</button>
                <button class="patch btn " type="button" value="2">2级</button>
                <button class="patch btn " type="button" value="3">3级</button>
                <button class="patch btn " type="button" value="4">4级</button>
            </div>
        </div>

    </div>

</div>

<!-- 全局js -->
<script src="/js/jquery.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
<!-- Bootstrap table -->
<script src="/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<!-- layer javascript -->
<script src="/js/plugins/layer/layer.min.js"></script>
<!-- layerDate plugin javascript -->
<script src="/js/plugins/layer/laydate/laydate.js"></script>

<script src="/js/zfms/common/commonUtils.js" type="text/javascript"></script>

<script src="/js/censor/censor_content.js" type="text/javascript"></script>

<script src="/js/censor/censor_audio.js" type="text/javascript"></script>
<script type="text/javascript">
    var statusGlobal = '';
    var levelGlobal = '';
    var indexGlobal = '';
    var contentType = 4;//（1-文本，2-图片，3-视频，4-音频）
    var objGlobal = {};
    //操作格式化
    function actionFormatter(value, row, index) {
        if(row.isDel == 1){
            return "已被删除";
        }else{
            return "<div class='btn-group'>"
                +"<button id='action' class='action btn btn-primary' type='button' value='1'>1级</button>"
                +"<button class='action btn btn-success' type='button' value='2'>2级</button>"
                +"<button class='action btn btn-warning' type='button' value='3'>3级</button>"
                +"<button class='action btn btn-danger' type='button' value='4'>4级</button></div>"
        }
    }
    //格式化等级
    function levelFormatter(value, row, index) {
        if(row.censorLevel == 0){
            return ;
        }else{
            return  row.censorLevel+"级";
        }
    }
    //电话格式化
    function phoneFormatter(value, row, index) {
        if(value==null||value == ""||value==undefined){
            return "";
        }
        console.info("phoneFormatter-value"+value);

        if(repeatFlag == false){
            var pat=/(\d{3})\d*(\d{4})/
            var phone=value.replace(pat,'$1****$2');
            repeatFlag = true
            return phone

        }
        return value;
        // var phone = value

    }

    function stateFormatter(value, row, index) {
        if(row.isDel == 1){
            return{
                disabled: true
            }
        }
    }
    //语音格式化
     function audioFormatter(value, row, index) {
        //alert(row.contentUrl)
         if(value==null||value == ""||value==undefined){
             return "";
         }else{
             var audioUrl =" <div class='weixinAudio'>\n" +
                 "       <audio src='"+row.contentUrl+"' id='media' width='1' height='1' preload='load' type='audio/mp3'></audio>\n" +
                 "       <span id='audio_area' class='db audio_area'>\n" +
                 "   <span class='audio_wrp db'>\n" +
                 "   <span class='audio_play_area'>\n" +
                 "   <i class='icon_audio_default'></i>\n" +
                 "       <i class='icon_audio_playing'></i>\n" +
                 "   </span>\n" +
                 "   </span>\n" +
                 "   </span>\n" +
                 "   </div>";
             return audioUrl;
         }

    }


    (function ($) {


        var demo = {};

        /**
         * 初始化
         */
        demo.init = function() {
            console.info("init-----------");
        }

        demo.param = function (params) {

            console.info($('#start').val());
            return {
                limit: params.limit,
                page: $('#listTable').bootstrapTable('getOptions').pageNumber,
                contentSourceType: $('#contentSourceType option:selected').val(),
                sender:$.trim($('#sender').val()),
                censorContent:$.trim($('#censorContent').val()),
                sendStartTime:$('#start').val(),
                sendEndTime:$('#end').val(),
                contentType:contentType,
                censorStatus:statusGlobal,
                censorLevel:levelGlobal
            };
        }
        demo.init();
        window.demo = demo;
    }(jQuery));

    //日期范围限制
    var start = {
        elem: '#start',
        format: 'YYYY/MM/DD hh:mm:ss',
        min: '1900-01-01 00:00:00', //设定最小日期为当前日期
        max: '2099-06-16 23:59:59', //最大日期
        istime: true,
        istoday: false,
        choose: function (datas) {
            end.min = datas; //开始日选好后，重置结束日的最小日期
            end.start = datas //将结束日的初始值设定为开始日
        }
    };
    var end = {
        elem: '#end',
        format: 'YYYY/MM/DD hh:mm:ss',
        min: '1900-01-01 00:00:00',
        max: '2099-06-16 23:59:59',
        istime: true,
        istoday: false,
        choose: function (datas) {
            start.max = datas; //结束日选好后，重置开始日的最大日期
        }
    };
    laydate(start);
    laydate(end);

</script>

</body>
</html>